﻿using System.IO;
using System.Net;
using System.ServiceModel.Activation;

namespace VisualStock.Web
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "DataDownloadService" in code, svc and config file together.

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class DataDownloadService : IDataDownloadService
    {
        public Stream DoDownLoad(string url)
        {
            WebClient wc = new WebClient();
            try
            {
                return wc.OpenRead(url);
            }
            catch (WebException)
            {
                return Stream.Null;
            }
        }
    }
}
